package main

import "fmt"

// 定义一个结构体
type person struct {
	name string
	age  int
	city string
}

// 相同类型的可以合并一起写
type Person struct {
	name, city string
	age        int
}

func main() {

	// 结构体实例化
	var ssc person
	ssc.name = "sunshicheng"
	ssc.city = "北京"
	ssc.age = 18
	//fmt.Println(ssc)
	fmt.Printf("%#v\n", ssc)
	//main.person{name:"sunshicheng", age:18, city:"北京"}

	var zcm Person
	zcm.name = "sunshicheng"
	zcm.city = "北京"
	zcm.age = 18
	fmt.Printf("%#v\n", zcm)
	// main.Person{name:"sunshicheng", city:"北京", age:18}

	// 匿名结构体 主要用于临时需要处理不同结构的数据
	var user struct {
		name    string
		married bool
	}

	user.name = "sunshicheng"
	user.married = false
	fmt.Printf("%#v\n", user)
	// struct { name string; married bool }{name:"sunshicheng", married:false}
}
